minimum Function

public function minimum(a) result(mn)

Function to calculate the minimum of an array

Arguments

Type IntentOptional Attributes Name
real(kind=wp), dimension(:) :: a

Real array

Return Value real(kind=wp)

Real value with the minimum


Source Code

    function minimum(a) result(mn)
!===================================================================================================
!! Function to calculate the minimum of an array
        real(kind=wp),dimension(:) :: a
!! Real array
        real(kind=wp) :: mn
!! Real value with the minimum
        integer :: i,number_elements
        mn=a(1)
        number_elements=size(a)
        do i=2,number_elements
          if(a(i) .lt. mn) then
            mn=a(i)
          endif
        enddo
!
     end function minimum